home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9493 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.7 KB

  1. Path: news.uni-stuttgart.de!schweikh
  2. From: schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: help: gcc
  5. Date: 11 Mar 1996 14:36:47 GMT
  6. Organization: Comp.Center (RUS), U of Stuttgart, FRG
  7. Message-ID: <4i1dpv$4fa8@info4.rus.uni-stuttgart.de>
  8. References: <4hsk0e$j8f@gail.ripco.com>
  9. NNTP-Posting-Host: itosun.ito.uni-stuttgart.de
  10.  
  11. In article <4hsk0e$j8f@gail.ripco.com>,
  12. Martin Ambuhl <mambuhl@ripco.com> wrote:
  13. >spiffy@seas.gwu.edu (Marc Goldberg) in
  14. ><4hpiht$1n2@cronkite.seas.gwu.edu> asks:
  15. >
  16. >
  17. >>2FarmCheck.c: In function `readHostFiles':
  18. >>2FarmCheck.c:23: dereferencing pointer to incomplete type
  19. >[etc.]
  20. >
  21. >>The lines referred to are:
  22. >
  23. >>char *readHostFiles(char *name)
  24. >>      {
  25. >>      int foo;
  26. >>      struct FILE *fileDisc;
  27. >       ^^^^^^
  28. >      Lose this.
  29. >
  30. >>(23)  *fileDisc = fopen("/users/spiffy/urls.txt", O_RDONLY);
  31.  
  32. It seems this code was using open() in days of yore and was
  33. hacked up to use fopen. Or why would anyone write O_RDONLY
  34. when probably "r" was intended?
  35.  
  36. Here's what TFM says on Solaris
  37. NAME
  38.      fopen, freopen, fdopen - open a stream
  39.  
  40. SYNOPSIS
  41.      #include <stdio.h>
  42.  
  43.      FILE *fopen(const char *filename, const char *type);
  44.  
  45.      FILE *freopen(const char *filename, const char *type,
  46.           FILE *stream);
  47.  
  48.      FILE *fdopen(int fildes, const char *type);
  49.  
  50. MT-LEVEL
  51.      MT-Safe
  52.  
  53. DESCRIPTION
  54.      fopen() opens the file named by filename  and  associates  a
  55.      stream  with  it.   fopen()  returns  a  pointer to the FILE
  56.      structure associated with the stream.
  57.  
  58.      filename points to a character string that contains the name
  59.      of the file to be opened.
  60.  
  61.      type is a character string beginning with one of the follow-
  62.      ing sequences:
  63.  
  64.           ``r'' or ``rb''          open for reading
  65.  
  66.           ``w'' or ``wb''          truncate  to  zero  length  or
  67.                                    create for writing
  68.  
  69.           ``a'' or ``ab''          append; open  for  writing  at
  70.                                    end  of  file,  or  create for
  71.                                    writing
  72.  
  73.           ``r+'', ``r+b'' or ``rb+''
  74.                                    open for update  (reading  and
  75.                                    writing)
  76.  
  77.           ``w+'', ``w+b'' or ``wb+''
  78.                                    truncate or create for update
  79.  
  80.           ``a+'', ``a+b'' or ``ab+''
  81.                                    append;  open  or  create  for
  82.                                    update at end-of-file
  83.  
  84.      The ``b'' is ignored in the above types. The ``b'' exists to
  85.      distinguish binary files from text files.  However, there is
  86.      no distinction between these types of files on a  UNIX  sys-
  87.      tem.
  88. ...
  89.  
  90. Bye, Jens
  91. -- 
  92. SIGSIG -- signature too long (core dumped)
  93.